package net.learn.vocabulary;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class struct extends Activity {
	public Context mContext;
	public ListView mList;
	private int iLesson;
	public static Lesson curlesson;
	static final String[] listStruct = new String[] {"Vocabulary","Grammar","Conversation","Game"};
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.struct);
        mContext = getApplicationContext();
        mList = (ListView)findViewById(R.id.liststruct);
        mList.setAdapter(new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1,listStruct));
        iLesson = Integer.parseInt(getIntent().getExtras().getString("lesson"));
        curlesson = new Lesson((String)("bai"+Integer.toString(iLesson+1)+".txt"), mContext);
        mList.setOnItemClickListener(new OnItemClickListener() {
			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				if(arg2 == 3){
					Intent i = new Intent(mContext,quiz.class );
					startActivity(i);
				}else if(arg2 == 1){
					Intent i = new Intent(mContext,gram.class );
					startActivity(i);
				}else if(arg2 == 0){
					Intent i = new Intent(mContext,word.class );
					startActivity(i);
				}else if(arg2 == 2){
					Intent i = new Intent(mContext,conv.class );
					startActivity(i);
				}
			}
		});
    }
}	
